function ngdomSpritePlayer() {
	ngdomSpritePlayer.prototype.base.constructor.call(this);

	this.speed = 0;
	this.moveSpeed = 2;
	this.runSpeed = 4;
	this.defaultSpeed = this.speed;
	this.direction = 3;
	this.reverseOnCollision = false;
	this.position = {
		x: 120,
		y: 135
	};
	this.type = 'player';
	this.zOffset = 10;
	this.level = 1;
	this.maxLevel = 4;
	this.health = 30;
	this.maxHealth = 30;
	this.lowHealthThreshold = 10;
	this.sceneDelay = 0;
	this.attackTurnDelay = -1;
	this.weapon = new ngdomSpriteWeapon(this);
	this.attackLength = 100;
	this.woundedLength = 800;
	this.woundedBounceLength = 100;
	this.dyingLength = 2400;
	this.xp = 0;
	this.inventory = {
		add: function (itemKey) {
			if (isNaN(this[itemKey])) this[itemKey] = 1;
			else this[itemKey]++;
		},
		has: function (itemKey) {
			return (!isNaN(this[itemKey]) && this[itemKey] > 0);
		}
	};
	this.cssClass = 'player';
	this.spriteKey = 'player';
	this.spriteStates = ['idle', 'move', 'dying'];
}
ngdomSpritePlayer.inherits(ngdomSprite);
ngdomSpritePlayer.prototype.enterScene = function () {
	ngdomSpritePlayer.prototype.base.enterScene.call(this);
	this.el.attr('id', 'player');
};
ngdomSpritePlayer.prototype.damage = function (amount, direction) {
	if (this.invincible) return;
	this.direction = direction;
	this.speed = -this.woundedBounceSpeed;
	this.engine.sounds.play('hurt');
	this.health -= amount;
	if (this.health < 0) this.health = 0;
	if (this.health <= this.lowHealthThreshold) this.engine.sounds.play('lowHealth');
	this.engine.ui.updateHud();
	
	if (this.health > 0) {
		this.wounded = true;
		this.woundedStartTime = this.engine.tickCount;
		this.showDamage();
	}
	else
		this.engine.death();
};
ngdomSpritePlayer.prototype.gainXP = function (xp) {
	if (xp == 0) return;
	this.xp += xp;
	if (this.xp > 100) {
		this.xp = 100;
	}
	if (this.xp == 100 && this.level < this.maxLevel) {
		this.level++;
		this.engine.sounds.play('levelUp');
	}
	this.engine.ui.updateHud();
	if (this.xp == 100) {
		this.xp = 0;
	}
};
ngdomSpritePlayer.prototype.save = function () {
	return {
		xp: this.xp,
		level: this.level
	};
};
ngdomSprite.prototype.load = function (data) {
	this.xp = !data || isNaN(data.xp) ? 0 : data.xp;
	this.level = !data || isNaN(data.level) ? 1 : data.level;
};